﻿using System;
using System.Web.UI;
using BO.Infrastructure.StaticData;
using BO.Infrastructure.Utils;
using BO.Video;
using GUI.Extensions;

namespace GUI.Pages.Video
{
    public partial class ListVideoByTag : System.Web.UI.Page
    {
        private const int Top = 16;

        protected void Page_Load(object sender, EventArgs e)
        {
            var videoZoneId = RequestExtensions.VideoZoneId;
            if (videoZoneId > 0)
            {
                var objZone = VideoBO.GetVideoZoneDetail(videoZoneId);
                if (objZone != null)
                {
                    ctrHighlightVideo.Visible = ctrHighlightVideo.DataBind(
                        VideoBO.GetVideoByMode(1, DefinedConstants.Video.Mode.NoiBat, zoneId: videoZoneId),
                        VideoBO.GetNewestVideo(Top, zoneId: objZone.Id)
                        );

                    #region Title/MetaData
                    PresentationUtils.AddMeta(Page, DefinedConstants.MetaAttributes.Description.Id,
                                              DefinedConstants.MetaAttributes.Description.Name, objZone.Description);
                    PresentationUtils.AddMeta(Page, DefinedConstants.MetaAttributes.Keywords.Id,
                                              DefinedConstants.MetaAttributes.Keywords.Name, objZone.Keywords);
                    PresentationUtils.AddMeta(Page, DefinedConstants.MetaAttributes.NewsKeywords.Id,
                                              DefinedConstants.MetaAttributes.NewsKeywords.Name, objZone.Keywords);

                    Page.Header.Title = string.Format("{0} | video | soha.vn", objZone.Name);
                    #endregion
                }
            }
        }
    }
}